<?php

namespace core\libs;

class input {
    public function __construct() {
    }

    public static function get() {
        return self::input_analysis($_GET, func_get_args());
    }
    public static function post() {
        return self::input_analysis($_POST, func_get_args());
    }
    public static function request() {
        return self::input_analysis($_REQUEST, func_get_args());
    }
    public static function session() {
        return self::input_analysis($_SESSION, func_get_args());
    }
    public static function cookie() {
        return self::input_analysis($_COOKIE, func_get_args());
    }
    private static function input_analysis($param, $args) {
        $temp = [];

        if(count($args) < 1) {
            $temp = $param;
        }
        if(count($args) == 1) {
            $temp = "";
            if(isset($param[$args[0]])) {
                $temp = $param[$args[0]];
            }
        }
        if(count($args) > 1) {
            foreach($args as $val) {
                $temp[$val] = "";
                if(isset($param[$val])) {
                    $temp[$val] = $param[$val];
                }
            }
        }

        return $temp;
    }
}